WDV221 Intro Javascript
Unit-3 - Functions
Please complete the following exercises on this page. When complete post this page to your server. Make a link in your WDV221 homework page for this assignment.
Submit this assignment on Blackboard. Please include a link to your homework page.
Use Javascript to complete the following tasks.
- Create a global variable and assign it with a string of your name
- Create a function called sayHello( ). The function will use the alert( ) function to display your name. Call it during runtime.
- Create a function called printHello( ). The function will use the document.write( ) function to display your name. Call it twice in a row during runtime.
- Call the printHello( ) function so that it prints your name inside of an h1 element.
- Create a function called characterCount( ).
- Create a local variable called testString.
- Use the prompt( ) to ask for a string. Store the result in the testString variable.
- Use the String.length property to get the number of characters in the variable.
- Display the results using an alert( ).
- Call this function using an event handler such as onclick.